<template>
    <div class="studentifo">
        <h3 v-text="msg"></h3>
        <h2>{{msg1}}</h2>
        <p>学生姓名：{{name}}</p>
        <p>年龄：{{age}}</p>
        <button @click="show">test</button>
        <p>该生来自：{{student_address}}</p>
        <Friends></Friends>
    </div>
</template>

<script>
// import {x} from "../minxin"
import Friends from "./Friends"
export default {
    name:"StudentNa",
    data(){
        return {
            msg:"学生个人信息",
            name:'苏凉',
            age:21,
            student_address:''
        }
    },
    components:{
        Friends
    },
    props:['msg1'],
    mounted(){
        this.$bus.$on('hello',(data)=>{
            this.student_address = data;
        })
        // this.$bus.$emit('click',this.name)
    },
    methods:{
        show(){
            this.$bus.$emit('showName',this.name)
            // console.log(111);
        }
    },
    beforeDestroy(){
        //解绑自定义事件
        this.$bus.$off('hello')
    }
}
</script>

<style>
    .studentifo{
        background-color: black;
    }
</style>
